Skip to content

fix!: Fix opts for methods listing issues and sub-issues#4016

Merged
gmlewis merged 3 commits intogoogle:masterfrom
alexandear-org:fix/list-issues-opts
Feb 17, 2026
Merged

fix!: Fix opts for methods listing issues and sub-issues#4016
gmlewis merged 3 commits intogoogle:masterfrom
alexandear-org:fix/list-issues-opts

Conversation

@alexandear
Copy link
Contributor

BREAKING CHANGE: Split IssuesService.List into IssuesService.ListAllIssues and IssuesService.ListUserIssues. IssuesService.ListByOrg now accepts IssueListByOrgOptions. SubIssueService.ListByIssue now accepts ListOptions.

Updates #3976
Closes #3694

@gmlewis
Copy link
Collaborator

gmlewis commented Feb 16, 2026

WHUPS! It looks like I jumped the gun for v83. Ah, well... sorry about that.

@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Feb 16, 2026
@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

❌ Patch coverage is 92.72727% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.04%. Comparing base (b7cf18f) to head (848cba8).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
github/issues.go 86.20% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4016      +/-   ##
==========================================
- Coverage   94.04%   94.04%   -0.01%     
==========================================
  Files         207      207              
  Lines       19174    19206      +32     
==========================================
+ Hits        18033    18063      +30     
- Misses        939      940       +1     
- Partials      202      203       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alexandear
Copy link
Contributor Author

Could we retrigger the lint step? Something wrong with the GitHub API.

@gmlewis
Copy link
Collaborator

gmlewis commented Feb 16, 2026

It looks like the test for ListByOrg could add a testBadOptions call to improve coverage.

@gmlewis
Copy link
Collaborator

gmlewis commented Feb 16, 2026

It looks like the test for ListByOrg could add a testBadOptions call to improve coverage.

and possibly the other methods too... see #4019 for more details.

@alexandear
Copy link
Contributor Author

@gmlewis I fixed the test ListByOrg and it increases coverage slightly.

But it's impossible to cover these lines:

image image

@gmlewis
Copy link
Collaborator

gmlewis commented Feb 16, 2026

But it's impossible to cover these lines:

Even with something like this?

opts := &ListAllIssuesOptions{Filter: "\n"}

@alexandear
Copy link
Contributor Author

But it's impossible to cover these lines:

Even with something like this?

opts := &ListAllIssuesOptions{Filter: "\n"}

Yes. I tried the following test:

func TestIssuesService_ListAllIssues_badOptions(t *testing.T) {
	t.Parallel()
	ctx := t.Context()
	client, mux, _ := setup(t)

	mux.HandleFunc("/issues", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "GET")
		testHeader(t, r, "Accept", mediaTypeReactionsPreview)
		fmt.Fprint(w, `[{"number":1}]`)
	})

	const methodName = "ListAllIssues"
	testBadOptions(t, methodName, func() (err error) {
		_, _, err = client.Issues.ListAllIssues(ctx, &ListAllIssuesOptions{
			Filter: "\n",
		})
		return err
	})
}
$ go test -run=^TestIssuesService_ListAllIssues_badOptions$ ./...
--- FAIL: TestIssuesService_ListAllIssues_badOptions (0.00s)
    issues_test.go:88: bad options ListAllIssues err = nil, want error
FAIL
FAIL    github.com/google/go-github/v82/github  0.571s
?       github.com/google/go-github/v82/test/fields     [no test files]
?       github.com/google/go-github/v82/test/integration        [no test files]
FAIL

@gmlewis
Copy link
Collaborator

gmlewis commented Feb 16, 2026

Yes. I tried the following test:

Ah! You are absolutely right! The URL becomes "issues?filter=%0A". Sorry about that, @alexandear, and thank you for trying!

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @alexandear!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @zyfy29 - @Not-Dhananjay-Mishra

Copy link
Contributor

@Not-Dhananjay-Mishra Not-Dhananjay-Mishra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gmlewis
Copy link
Collaborator

gmlewis commented Feb 17, 2026

Thank you, @Not-Dhananjay-Mishra!
Merging.

@gmlewis gmlewis changed the title fix!: Fix opts for methods listing issues and sub-issues fix!: Fix opts for methods listing issues and sub-issues Feb 17, 2026
@gmlewis gmlewis merged commit a2d86b0 into google:master Feb 17, 2026
7 of 8 checks passed
@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Feb 17, 2026
@alexandear alexandear deleted the fix/list-issues-opts branch February 17, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments